package businesslogic.Strategybl;

import VO.StrategyVO;
import service.StrategyService.HotelStrategyService;
import util.Message;
import util.UserType;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Iterator;

/**
 * Created by insomnia on 2016/10/27.
 * 酒店促销策略的controller
 */
public class HotelStrategyController implements HotelStrategyService {
    /**持有一个HotelStrategy的引用*/
    private HotelStrategy hotelStrategy;
    /**构造函数*/
    public HotelStrategyController(){
        try{
            hotelStrategy=new HotelStrategy();
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    /***
     * 根据酒店id得到酒店促销策略
     * @return 促销策略迭代器
     * @throws RemoteException
     */
    public Iterator<StrategyVO> getStrategy(String hotelid) throws RemoteException {

        return hotelStrategy.getStrategy(hotelid);
    }
    /***
     * 添加新的酒店撤销策略
     * @param strategyVO 促销策略的VO对象
     * @return 是否成功添加新的促销策略或相应的错误信息
     * @throws RemoteException
     */
    public Message addNewStrategy(StrategyVO strategyVO) throws RemoteException {
        return hotelStrategy.addNewStrategy(strategyVO);
    }
    /***
     * 移除酒店促销策略
     * @param strategyVO 促销策略的VO对象
     * @return 是否成功移除酒店促销策略
     * @throws RemoteException
     */
    public boolean removeStrategy(StrategyVO strategyVO) throws RemoteException {
        return hotelStrategy.removeStrategy(strategyVO);
    }
}
